package com.ht.medicaltreatment.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.ht.medicaltreatment.R
import com.ht.medicaltreatment.bean.Page
import com.youth.banner.util.LogUtils

class SubjectsAdaptger:BaseQuickAdapter<Page,BaseViewHolder>(R.layout.item_subjects_layout) {
    init {
        addChildClickViewIds(R.id.btnReplaceRFID)
    }
    override fun convert(holder: BaseViewHolder, item: Page) {
        val imgSex = holder.getView<ImageView>(R.id.imgSex)
        holder.setText(R.id.tvCode,"${item.patientCode?:""}")
        holder.setText(R.id.tvName,item.patientName)
        holder.setText(R.id.tvTitle,item.patientCode)
        holder.setText(R.id.tvIdCode,item.patientIdCard)
        holder.setText(R.id.tvSX,"姓名缩写: ${item.patientNamecode}")
        holder.setText(R.id.tvLocation,"病房：${item.ward.name}")
        val dd = item.patientSex == "男"
        LogUtils.i(dd.toString())
        if(item.patientSex == "男"){
            imgSex.setBackgroundResource(R.drawable.icon_man)
        }else{
            imgSex.setBackgroundResource(R.drawable.icon_women)
        }

    }

}
